//
//  NSString+Ext.m
//  AutomaticCoder
//
//  Created by lang on 2021/11/22.
//  Copyright © 2021 me.zhangxi. All rights reserved.
//

#import "NSString+Ext.h"

@implementation NSString (Ext)

- (NSString *)capitalizeFirst {
    if (self.length < 1) {
        return @"";
    }
    else if (self.length == 1) {
        return [self capitalizedString];
    }
    else {
        NSString *firstChar = [self substringToIndex:1];
        NSString *otherChars = [self substringWithRange:NSMakeRange(1, self.length - 1)];
        return [NSString stringWithFormat:@"%@%@", [firstChar uppercaseString], otherChars];
    }
}

@end
